using System;
using System.Collections.Generic;
using System.Xml.Linq;
using Caliburn.Micro;
using MediaOwl.LastFm.Model;

namespace MediaOwl.LastFm.Data
{
    public interface ILastFmDataRepository
    {
        IDictionary<Type, Search> SearchDictionary { get; set; }
        Search CurrentArtistSearch { get; }
        Search CurrentAlbumSearch { get; }
        Search CurrentTrackSearch { get; }

        Search SetOrCreateSearch<T>(XElement xmlData)
            where T : EntityBase;

        IResult GetArtists(string searchString, Action<IEnumerable<Artist>, Search> onSuccess, Action<Exception> onFail = null,
                   int page = 0);

        IResult GetArtists(Action<IEnumerable<Artist>, Search> onSuccess, Action<Exception> onFail = null, int page = 0);
        IResult GetArtist(string artistId, bool isMusicBrainzId, Action<Artist> onSuccess,
                          Action<Exception> onFail = null);
        IResult GetArtist(ArtistBase artistBase, Action<Artist> onSuccess, Action<Exception> onFail = null);
        IResult GetBiographyOfArtist(Artist artist, Action<Biography> onSuccess, Action<Exception> onFail = null);

        IResult GetTopAlbumsOfArtist(Artist artist, Action<IEnumerable<Album>> onSuccess,
                                     Action<Exception> onFail = null);

        IResult GetTopTracksOfArtist(Artist artist, Action<IEnumerable<Track>> onSuccess,
                                     Action<Exception> onFail = null);

        IResult GetTopTagsOfArtist(Artist artist, Action<IEnumerable<Tag>> onSuccess, Action<Exception> onFail = null);

        IResult GetNextEventsOfArtist(Artist artist, Action<IEnumerable<Event>> onSuccess,
                                      Action<Exception> onFail = null);

        IResult GetSimilarArtists(Artist artist, Action<IEnumerable<ArtistBase>> onSuccess,
                                  Action<Exception> onFail = null);

        IResult GetAlbums(string searchString, Action<IEnumerable<Album>, Search> onSuccess, Action<Exception> onFail = null, int page = 0);
        IResult GetAlbums(Action<IEnumerable<Album>, Search> onSuccess, Action<Exception> onFail = null, int page = 0);
        IResult GetAlbum(string albumName, string artistName, Action<Album> onSuccess, Action<Exception> onFail = null, string musicBrainzId = null);
        IResult GetAlbum(Album album, Action<Album> onSuccess, Action<Exception> onFail = null);
        IResult GetTracks(string searchString, Action<IEnumerable<Track>, Search> onSuccess, Action<Exception> onFail = null, string artistName = null, int page = 0);
        IResult GetTracks(Action<IEnumerable<Track>, Search> onSuccess, Action<Exception> onFail = null, int page = 0);
        IResult GetTrack(string trackName, string artistName, Action<Track> onSuccess, Action<Exception> onFail = null, string musicBrainzId = null);
        IResult GetTrack(Track track, Action<Track> onSuccess, Action<Exception> onFail = null);
        IResult GetSimilarTracks(Track track, Action<IEnumerable<Track>> onSuccess, Action<Exception> onFail = null);
        IResult GetTopTags(Action<IEnumerable<Tag>> onSuccess, Action<Exception> onFail = null);
        IResult GetTopAlbumsOfTag(Tag tag, Action<IEnumerable<Album>> onSuccess, Action<Exception> onFail = null);
        IResult GetTopArtistsOfTag(Tag tag, Action<IEnumerable<Artist>> onSuccess, Action<Exception> onFail = null);
        IResult GetTopTracksOfTag(Tag tag, Action<IEnumerable<Track>> onSuccess, Action<Exception> onFail = null);
        IResult GetWeeklyArtistChartOfTag(Tag tag, Action<IEnumerable<Artist>> onSuccess, Action<Exception> onFail = null);
    }
}